var colors = ["red","green"];
console.log(colors.join());
console.log(colors.join(":"));

var str = "sky,is,mine";
var aStr=str.split(",");
console.log(aStr);
aStr = str.split("");
console.log(aStr);



var arr = new Array();
var count = arr.push("red","green");
console.log(arr);
console.log(count);
count = arr.push("black","blue");
console.log(arr);
console.log(count);

var item = arr.pop();
console.log(item);
console.log(arr);
var newLenth = arr.unshift("a","b","c");
console.log(arr);
console.log(arr.reverse());


console.log(newLenth);
var res =  arr.shift();
console.log(res);


console.log("---------------------------");
var values = [0,2,1,5,4];
values.sort()
console.log(values);

console.log("---------------------------");
var p1 = {name:"11",age:19};
var p2 = {name:"22",age:18};
var p3 = {name:"33",age:20};
var p4 = {name:"44",age:18};
var pArr = new Array(p1,p2,p3,p4);
console.log(pArr);

function compares(p1,p2){
    if(p1.age<p2.age){
        return -1;
    }else if(p1.age>p2.age){
        return 1;
    }else{
        if(p1.name<p2.name){
            return -1;
        }else if(p1.name>p2.name){
            return 1;
        }else{
            return 0;
        }
    }

}
pArr.sort(compares);
console.log(pArr);

console.log("------------随机排序-----------");
var newArrr= pArr.sort(function(){
    return Math.random-0.5;
})
console.log(newArrr);

var str = "AaBb";
console.log(str.toLowerCase());
console.log(str.toUpperCase());

